﻿#pragma once
#include "Comm.h"
#include "CommType.h"

namespace COMM
{
	class COMM_API Array
	{
	public:
		Array();
		virtual ~Array();
		Array(const Array& rhs);
		Array& operator=(const Array& rhs);

		int count() const;
		CommType& get(int index);
		const CommType& get(int index) const;
		CommType& operator[](int index);
		const CommType& operator[](int index) const;
		Array& append(const CommType& inst);
		Array& insert(int index, const CommType& inst);	
		Array& remove(int index);
		Array& clear();
		Array& operator<<(const CommType& inst);
	
	private:
		void* m_list;
	};

	class COMM_API Arguments : public Array
	{
	public:
		operator Buffer() const;
		Buffer Serialize() const;
		StringList ToStringList() const;
		static Arguments Deserialize(const void* buffer, size_t size);
		static Arguments Deserialize(const Buffer& buffer);
	};

}
